
using System;

namespace MyUtility.Utility
{
    public static class TimeUtils
    {
        /// <summary>
        /// 获取从1970年到现在的所有秒数
        /// </summary>
        /// <returns></returns>
        public static long GetNowTimestamp()
        {
            var ts = DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            var sval = Convert.ToInt64(ts.TotalMilliseconds);
            return sval;
        }

        /// <summary>
        /// 获取从1970年到现在的所有秒数的字符串
        /// </summary>
        /// <returns></returns>
        public static string GetNowTImestampStr()
        {
            var ts = GetNowTimestamp();
            var sStr = ts.ToString();
            return sStr;
        }


    }


}